import enum


角色基础 = {
    "元素师": {
        "力量": 170,
        "智力": 413,
        "物攻": 0,
        "魔攻": 0,
        "火强": 0,
        "冰强": 0,
        "光强": 0,
        "暗强": 0,
        "火抗": 0,
        "冰抗": 0,
        "光抗": 0,
        "暗抗": 0,
    }
}

甲类常数 = {"皮甲": 3, "板甲": 8, "重甲": 8, "轻甲": 8, "布甲": 8}
部位系数 = {"上衣": 0.30, "头肩": 0.20, "下装": 0.25, "腰带": 0.10, "鞋": 0.15}
品级加分 = {"普通": 9, "高级": 11, "稀有": 16, "神器": 25, "史诗": 36}
暴击 = {
    "皮甲":{
        "头肩":0.01,
        "上衣":0.015,
        "下装":0.0125,
        "腰带":0.005,
        "鞋":0.0075
    }
}


def 精通计算(装备等级, 品质, 部位, 甲类,输出类型="物理", buffer: bool = False)->dict:
    num = round(
        ((3 if buffer else 甲类常数[甲类]) + 1.2 * (装备等级 + 品级加分[品质]))
        * 部位系数[部位],
        2,
    )
    return {
        "STR": num if 输出类型 == "物理" else 0,
        "INT": num if 输出类型 == "魔法" else 0,
        "CriticalPP":暴击.get("甲类",{}).get(部位,0) if 输出类型 == "物理" else 0,
        "CriticalMP":暴击.get("甲类",{}).get(部位,0) if 输出类型 == "魔法" else 0,
    }


class CharacterInfo(enum.Enum):


    def __init__(self, name, icon,func) -> None:
        self._name = name
        self._icon = icon
        self._func = func

    @property
    def name(self):
        return self._name

    @property
    def icon(self):
        return self._icon

    def value(self,value):
        return self._func(value)

    STR = "力量", "/ui/UI_ProfileIcon_002.png",lambda x:round(x,0)
    """力量"""

    INT = "智力", "/ui/UI_ProfileIcon_003.png",lambda x:round(x,0)
    """智力"""

    AtkP = "物理攻击力", "/ui/UI_ProfileIcon_006.png",lambda x:round(x,0)
    """物理攻击力"""

    AtkM = "魔法攻击力", "/ui/UI_ProfileIcon_007.png",lambda x:round(x,0)
    """魔法攻击力"""

    PAtkP = "物理攻击力%", "/ui/UI_ProfileIcon_006.png",lambda x:f'{format(x*100, ".2f")}%'
    """物理攻击力增加%"""

    PAtkM = "魔法攻击力%", "/ui/UI_ProfileIcon_007.png",lambda x:f'{format(x*100, ".2f")}%'
    """魔法攻击力增加%"""

    PDamage = "伤害增加", "/ui/UI_ProfileIcon_036.png",lambda x:f'{format(x*100, ".2f")}%'
    """伤害增加%"""

    PDamageC = "暴击伤害增加", "/ui/UI_ProfileIcon_046.png",lambda x:f'{format(x*100, ".2f")}%'
    """暴击伤害增加%"""

    PSTR = "力量增加", "/ui/UI_ProfileIcon_002.png",lambda x:f'{format(x*100, ".2f")}%'
    """力量增加%"""

    PINT = "智力增加", "/ui/UI_ProfileIcon_003.png",lambda x:f'{format(x*100, ".2f")}%'
    """智力增加%"""

    PDamageB = "附加伤害", "/ui/UI_ProfileIcon_045.png",lambda x:f'{format(x*100, ".2f")}%'
    """附加伤害%"""

    # PDamageBEMax: dict[str, float]

    ElementA: dict[str, float]
    # """属性攻击"""

    ElementDB0 = "火属性强化", "/ui/UI_ProfileIcon_022.png",lambda x:round(x,0)

    ElementR0 = "火属性抗性", "/ui/UI_ProfileIcon_023.png",lambda x:round(x,0)

    ElementDB1 = "冰属性强化", "/ui/UI_ProfileIcon_024.png",lambda x:round(x,0)

    ElementR1 = "冰属性抗性", "/ui/UI_ProfileIcon_025.png",lambda x:round(x,0)

    ElementDB2 = "光属性强化", "/ui/UI_ProfileIcon_026.png",lambda x:round(x,0)

    ElementR2 = "光属性抗性", "/ui/UI_ProfileIcon_027.png",lambda x:round(x,0)

    ElementDB3 = "暗属性强化", "/ui/UI_ProfileIcon_028.png",lambda x:round(x,0)

    ElementR3 = "暗属性抗性", "/ui/UI_ProfileIcon_029.png",lambda x:round(x,0)

    CriticalMP = "魔法暴击率", "/ui/UI_ProfileIcon_011.png",lambda x:f'{format(x*100, ".2f")}%'
    """魔法暴击率%"""

    CriticalM = "魔法暴击", "/ui/UI_ProfileIcon_011.png",lambda x:round(x,0)
    """魔法暴击"""

    CriticalPP = "物理暴击率", "/ui/UI_ProfileIcon_010.png",lambda x:f'{format(x*100, ".2f")}%'
    """物理暴击率%"""

    CriticalP = "物理暴击", "/ui/UI_ProfileIcon_010.png",lambda x:round(x,0)
    """物理暴击"""

    EquipmentSkillAttack = "技能攻击力增加", "/ui/UI_ProfileIcon_047.png",lambda x:f'{format(x*100-100, ".2f")}%'
    """技能攻击力"""

    SpeedA = "攻击速度", "/ui/UI_ProfileIcon_012.png",lambda x:f'{format(x*100, ".2f")}%'
    """攻击速度"""

    SpeedM = "移动速度", "/ui/UI_ProfileIcon_014.png",lambda x:f'{format(x*100, ".2f")}%'
    """移动速度"""

    SpeedR = "施放速度", "/ui/UI_ProfileIcon_013.png",lambda x:f'{format(x*100, ".2f")}%'
    """施放速度"""

    # HitP : float
    # """命中率"""

    # Hit : float
    # """命中"""
